/*
** my_verif.c for alum1 in /home/nadali_t//local/Projets/CprgElem/alum1
** 
** Made by thomas nadalie
** Login   <nadali_t@epitech.net>
** 
** Started on  Mon Feb  6 14:31:30 2012 thomas nadalie
** Last update Mon Feb  6 18:30:44 2012 thomas nadalie
*/

#include	"my.h"

int	is_a_num(char c)
{
  if (c >= 48 && c <= 57)
    return (1);
  else
    return (0);
}

int	count_alum(char **alum)
{
  int	i;
  int	j;
  int	k;

  i = 0;
  k = 0;
  j = 0;
  while (alum[i] != NULL)
    {
      if (alum[i++][k++] == '|')
	j++;
      else
	i++;
    }
  if (j < 3 || j == 0)
    return (1);
  return (0);
}

int	is_a_line(char **alum, int line)
{
  int	i;

  i = 0;
  while (alum[i] != NULL)
      i++;
  if (line > i)
    {
      my_put_err("Invalid line number \n");
      return (1);
    }
  return (0);
}

void	my_line(char **alum)
{
  char	line;
  int	i;
  int	k;
  int	l;

  i = 0;
  k = 0;
  while ()
    {
      my_bzero(&line);
      my_putstr("Enter line number: ");
      read(0, &line, 1);
      my_putchar('\n');
      if (is_a_num(line) == 0)
	l = char_to_int(line);
      else if (is_a_line(line) == 0)
	my_pos(alum);
      else
	my_put_err("Invalid line numer \n");
    }
}

void	my_nb(char **alum)
{
  char	nb;
  int	i;
  int   p;

  i = 0;
  while (1)
    {
      my_bzero(&pos);
      my_putstr("Enter the number of matches to withdraw: ");
      read(0, &pos, 1);
       if (is_a_num(pos) == 0)
	p = char_to_int(pos);
      else
	my_put_err("Invalid argument");
      my_put_nbr(p);
      //if (count_alum(alum) == 0)
	//my_dell(line, pos);
    }
}
